package com.iscas.dataaggregation.strategy;

import java.util.Map;

public class StressChaosStrategy implements ChaosFaultTypeStrategy {

    @Override
    public String getFaultType(Map<String, Object> data) {
        String chaosType = (String) data.get("chaosType");
        Map<String, Object> chaosData = (Map<String, Object>) data.get(chaosType);

        // 获取 stressors 下的键
        Map<String, Object> stressors = (Map<String, Object>) chaosData.get("stressors");
        if (stressors.containsKey("cpu")) {
            return chaosType + " cpu";
        } else if (stressors.containsKey("memory")) {
            return chaosType + " memory";
        }

        return chaosType + " unknown";
    }
}
